//
// Created by Lapland on 2022/10/18.
//
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int maxn=1e6+5;
typedef long long ll;
const int mod=1e9+7;
ll f[maxn],ans;
ll quick(ll a,ll b)
{
ll ans=1;
a=a%mod;
while(b!=0)
{
if(b&1) ans=(ans*a)%mod;
b>>=1;
a=(a*a)%mod;
}
return ans;
}
ll C(int n,int m)
{
if(n<m) return 0;
return f[n]*quick(f[m],mod-2)%mod*quick(f[n-m],mod-2)%mod;
}
bool check(int n,int a,int b)
{
while(n>0)
{
if(n%10!=a&&n%10!=b) return 0;
n/=10;
}
return 1;
}
int main()
{
int n,a,b;
scanf("%d%d%d",&a,&b,&n);
f[0]=1;
for(int i=1;i<=n;++i) f[i]=(f[i-1]*i)%mod;
for(int i=0;i<=n;++i)
if(check(i*a+(n-i)*b,a,b)) ans=(ans+C(n,i))%mod;
printf("%lld\n",ans);
}
337A - Puzzles | 495A - Digital Counter |
796A - Buying A House | 67A - Partial Teacher |
116A - Tram | 1472B - Fair Division |
1281C - Cut and Paste | 141A - Amusing Joke |
112A - Petya and Strings | 677A - Vanya and Fence |
1621A - Stable Arrangement of Rooks | 472A - Design Tutorial Learn from Math |
1368A - C+= | 450A - Jzzhu and Children |
546A - Soldier and Bananas | 32B - Borze |
1651B - Prove Him Wrong | 381A - Sereja and Dima |
41A - Translation | 1559A - Mocha and Math |
832A - Sasha and Sticks | 292B - Network Topology |
1339A - Filling Diamonds | 910A - The Way to Home |
617A - Elephant | 48A - Rock-paper-scissors |
294A - Shaass and Oskols | 1213A - Chips Moving |
490A - Team Olympiad | 233A - Perfect Permutation |